The present invention relates to a miniaturized device controlled by electromagnetic signals in the radiofrequency range for the controlled release or sampling of substances or specimens, which, thanks to its small dimensions, is suited to being integrated in a capsule for medical, industrial or environmental uses, for example, for release of a drug along the gastrointestinal tract of a living organism after ingestion. In particular, the device according to the present invention comprises a reservoir and a valve structure associated to said reservoir, the functions of opening and closing of which are controlled by an electromagnetic signal in the radiofrequency range.